/*******************************************************************************
 *	                           bsp ram clear.c
 *******************************************************************************/
#include "bsp.h"
#include "common.h"

/*
 * ram clr
 */
#include "stdint.h"

extern uint32_t *__Vectors;

/*******************************************************************************
 * @brief  mem_clr define
 * \param[in] none
 * \retval: none
 *******************************************************************************/
#define mem_clr(base, size)     \
    pdata = (uint32_t *)(base); \
    Len = (size) / 4;           \
    while (Len--)               \
    {                           \
        *pdata++ = 0;           \
    }

/*******************************************************************************
 * @brief  ram_clr
 * \param[in] none
 * \retval: none
 *******************************************************************************/
void ram_clr(void)
{
    volatile uint32_t *pdata;
    register uint32_t Len;

    // bank 1
    mem_clr(0x20000000, 0x20000);

    // bank 2
    mem_clr(0x20020000, 0x10000);

    NOP1();
}
